<#-- @ftlvariable name="entity" type="com.xci.edu.core.entity.EduValidateQuestion" -->
<#include "/sys/_layout.ftl">
<#assign allowInsert=sysWeb.auth("edu.validateQuestion.insert")/>
<#assign allowUpdate=sysWeb.auth("edu.validateQuestion.update")/>
<#assign allowDelete=sysWeb.auth("edu.validateQuestion.delete")/>
<#assign allowExport=sysWeb.auth("edu.validateQuestion.export")/>
<!doctype html>
<html>
<head>
    <@pageHeader/>
</head>
<body>
<@pageLoading/>
<div id="gridtoolbar">
    <form id="gridform" class="jxlayout-form form-inline jxform">
        <div class="form-group">
            <input name="key" class="form-control w-250px" placeholder="请输入查询关键字" autocomplete="off">
        </div>
        <button class="btn btn-primary ml-5" type="submit">
            <i class="fa fa-search"></i> 查询
        </button>
        <div class="btn-group">
            <@echo test=allowInsert>
                <a class="btn btn-default" onclick="curd.createData()">
                    <i class="icon-plus"></i> 新建
                </a>
            </@echo>
            <@echo test=allowUpdate>
                <a class="btn btn-default" onclick="curd.editData()">
                    <i class="icon-pencil"></i> 编辑
                </a>
            </@echo>
            <@echo test=allowDelete>
                <a class="btn btn-default" onclick="curd.deleteData()">
                    <i class="icon-trash"></i> 删除
                </a>
            </@echo>
            <@echo test=allowExport>
                <a class="btn btn-default" onclick="curd.exportData()">
                    <i class="icon-share-alt"></i> 导出
                </a>
            </@echo>
            <@echo test=allowExport>
                <a class="btn btn-default" onclick="curd.validateById()">
                    <i class="icon-share-alt"></i> 开始验证
                </a>
            </@echo>
        </div>
    </form>
</div>
<table id="grid" data-options="form:'#gridform',toolbar:'#gridtoolbar'">
    <thead>
    <tr>
        <th data-options="field:'ck',checkbox:true"></th>
        <th data-options="title:'标题',field:'name',width:200,align:'left',sortable: false"></th>
        <th data-options="title:'选项A',field:'optionA',width:200,align:'left',sortable: false"></th>
        <th data-options="title:'选项B',field:'optionB',width:200,align:'left',sortable: false"></th>
        <th data-options="title:'选项C',field:'optionC',width:200,align:'left',sortable: false"></th>
        <th data-options="title:'选项D',field:'optionD',width:200,align:'left',sortable: false"></th>
        <th data-options="title:'正确答案',field:'answer',width:200,align:'left',sortable: false,formatter:formatAnswer"></th>
    </tr>
    </thead>
</table>
<@pageFooter/>
<script>
    function formatAnswer(v, row, index) {
        return '<span class="label label-success" style="font-size:14px" >' + v + '</span>';
    }

    jx.ready(function () {
        window.curd = new jx.GridCurd('#grid', {
            title: '验证问题',
            dialogWidth: '600px',
            dialogHeight: '450px',
            api: {
                grid: '/background/eduValidateQuestion/grid',
                create: '/background/eduValidateQuestion/create',
                edit: '/background/eduValidateQuestion/edit',
                delete: '/background/eduValidateQuestion/delete',
                details: '/background/eduValidateQuestion/details',
                export: '/background/eduValidateQuestion/export'
            }
        });

        curd.validateById = function () {
            jx.dialog({
                title: '验证窗体',
                url: jx.url('/background/eduValidateQuestion/validate'),
                // params: {roleIds: [id]},
                width: '40%',
                height: '40%'
            });
        };
    });

</script>
</body>
</html>
